// Copyright (c) 2020 Presto Labs Pte. Ltd.
// Author: xguo

#pragma once

#include <cstdlib>
#include <iostream>
#include <memory>
#include <string>

#include "coin2/exchange/base/order/order.h"
#include "coin2/exchange/huobi_futures/api_order/native_private_client.h"

namespace coin2::exchange::huobi_futures::api_order {

class HuobiFuturesRestAsyncAsioSubscriber : public base::order::RestSubscriber {
 public:
  using RestSubscriberBase = coin2::exchange::base::order::RestSubscriber;
  using RestClient = HuobiFuturesNativePrivateClient;
  using RestParams = HuobiFuturesNativePrivateClient::RestParams;

 public:
  using RestSubscriber::RestSubscriber;
  auto rest_client() { return dynamic_cast<RestClient*>(rest_client_); }
  void QueryBalance();
  void QueryPosition();
  void QueryOpenOrders(const std::string& native_symbol);
  void QueryCancelOrders(const std::string& native_symbol);
  void QueryFill(const std::string& native_symbol);
  void QueryTransfer(const std::string& native_symbol);
  void SubscribeAsync() override;
  bool SkipQuery(const std::string& task_name, const std::string& native_symbol);

 private:
  void SetParamsSymbol(const std::string& native_symbol, RestParams* params) const;
};

}  // namespace coin2::exchange::huobi_futures::api_order
